package com.ponhu.ea2.goodsCenter.provider.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ponhu.ea2.entity.PhInventoryDownloadLogs;
import com.ponhu.ea2.goodsCenter.provider.mapper.PhInventoryDownloadLogsMapper;
import com.ponhu.ea2.goodsCenter.provider.service.PhInventoryDownloadLogsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ponhu.ea2.query.InventoryDownloadTaskQuery;
import org.springframework.stereotype.Service;

@Service
public class PhInventoryDownloadLogsServiceImpl
        extends ServiceImpl<PhInventoryDownloadLogsMapper, PhInventoryDownloadLogs>
        implements PhInventoryDownloadLogsService {

    @Override
    public IPage<PhInventoryDownloadLogs> getDownloadTaskList(InventoryDownloadTaskQuery taskQuery) {

        LambdaQueryWrapper<PhInventoryDownloadLogs> queryWrapper = Wrappers
                .lambdaQuery(PhInventoryDownloadLogs.class)
                .eq(PhInventoryDownloadLogs::getOperatorId, taskQuery.getOperatorId())
                .orderByDesc(PhInventoryDownloadLogs::getCreateTime);

        Page queryPageInfo = new Page(taskQuery.getPageIndex(), taskQuery.getPageSize());

        return page(queryPageInfo, queryWrapper);
    }

}
